home *** CD-ROM | disk | FTP | other *** search
/ Motor Sport Digital Archive Collection 1960s / Motor Sport Digital Archive Collection 1960s.iso / main.swf / scripts / mx / utils / XMLNotifier.as < prev   
Encoding:
Text File  |  2008-05-21  |  2.7 KB  |  98 lines

  1. package mx.utils
  2. {
  3.    import flash.utils.Dictionary;
  4.    import mx.core.mx_internal;
  5.    
  6.    use namespace mx_internal;
  7.    
  8.    public class XMLNotifier
  9.    {
  10.       private static var instance:XMLNotifier;
  11.       
  12.       mx_internal static const VERSION:String = "2.0.1.0";
  13.       
  14.       public function XMLNotifier(param1:XMLNotifierSingleton)
  15.       {
  16.          super();
  17.       }
  18.       
  19.       public static function getInstance() : XMLNotifier
  20.       {
  21.          if(!instance)
  22.          {
  23.             instance = new XMLNotifier(new XMLNotifierSingleton());
  24.          }
  25.          return instance;
  26.       }
  27.       
  28.       mx_internal static function initializeXMLForNotification(param1:XML) : Function
  29.       {
  30.          var notificationFunction:Function = null;
  31.          var node:XML = param1;
  32.          notificationFunction = function(param1:Object, param2:String, param3:Object, param4:Object, param5:Object):void
  33.          {
  34.             var _loc7_:Dictionary = null;
  35.             var _loc8_:Object = null;
  36.             _loc7_ = arguments.callee.watched;
  37.             if(_loc7_ != null)
  38.             {
  39.                for(_loc8_ in _loc7_)
  40.                {
  41.                   IXMLNotifiable(_loc8_).xmlNotification(param1,param2,param3,param4,param5);
  42.                }
  43.             }
  44.          };
  45.          node.setNotification(notificationFunction);
  46.          return notificationFunction;
  47.       }
  48.       
  49.       public function watchXML(param1:Object, param2:IXMLNotifiable) : void
  50.       {
  51.          var _loc3_:XML = null;
  52.          var _loc4_:Object = null;
  53.          var _loc5_:Dictionary = null;
  54.          _loc3_ = XML(param1);
  55.          _loc4_ = _loc3_.notification();
  56.          if(!(_loc4_ is Function))
  57.          {
  58.             _loc4_ = mx_internal::initializeXMLForNotification(_loc3_);
  59.          }
  60.          if(_loc4_["watched"] == undefined)
  61.          {
  62.             _loc4_["watched"] = _loc5_ = new Dictionary(true);
  63.          }
  64.          else
  65.          {
  66.             _loc5_ = _loc4_["watched"];
  67.          }
  68.          _loc5_[param2] = true;
  69.       }
  70.       
  71.       public function unwatchXML(param1:Object, param2:IXMLNotifiable) : void
  72.       {
  73.          var _loc3_:XML = null;
  74.          var _loc4_:Object = null;
  75.          var _loc5_:Dictionary = null;
  76.          _loc3_ = XML(param1);
  77.          _loc4_ = _loc3_.notification();
  78.          if(!(_loc4_ is Function))
  79.          {
  80.             _loc4_ = mx_internal::initializeXMLForNotification(_loc3_);
  81.          }
  82.          if(_loc4_["watched"] != undefined)
  83.          {
  84.             _loc5_ = _loc4_["watched"];
  85.             delete _loc5_[param2];
  86.          }
  87.       }
  88.    }
  89. }
  90.  
  91. class XMLNotifierSingleton
  92. {
  93.    public function XMLNotifierSingleton()
  94.    {
  95.       super();
  96.    }
  97. }
  98.